package com.tang.objectOriented.basics.thiss;

public class Dogtest {
    public static void main() {
        Dog d = new Dog("tim", 11);
        d.info();
    }
}


class Dog {
    public String name;
    public int age;

    //public Dog(String Name, int Age) {
    public Dog(String name, int age) {
        //name = name; 同名会被作用域影响
        //age = age;　同名会被作用域影响
        //name = Name; 但是如果这样子写不是很友好
        //age = Age;　但是如果这样子写不是很友好
        this.name = name; //this 代表当前　对象的　属性　(虚拟机会给每个Dog对象分配this)
        this.age = age;//this 代表当前　对象的　属性 (虚拟机会给每个Dog对象分配this)
    }

    public void info() {
//        System.out.println("name=" + name, "age=" + age);
    }
}
